package com.wanshu.service.impl;

import com.alibaba.fastjson.JSON;
import com.wanshu.entity.User;
import com.wanshu.dao.UserDao;
import com.wanshu.entity.vo.UserInfo;
import com.wanshu.service.UserService;

import java.io.IOException;
import java.util.List;

public class UserServiceImpl implements UserService {

    private UserDao userDao; //自动注入 byName 当前类小驼峰名字

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }


    @Override
    public List<User> findAll() throws IOException {
        return userDao.findAll();
    }

    @Override
    public User login(User user) {
        return userDao.login(user);
    }

    @Override
    public UserInfo getUserInfo(Integer id) {
        return userDao.getUserInfo(id);
    }

    @Override
    public Integer insert(User user) {
        return userDao.insert(user);
    }

    public Integer update(User user){
        userDao.update(user);
        return null;
    }

    @Override
    public Integer delete(Integer id) {
        return null;
    }

    @Override
    public Boolean uploadHeadImage(User user) {
        return userDao.uploadHeadImage(user);
    }

    @Override
    public void updateUserAvatar(String filePath) {
        userDao.updateUserAvatar(filePath);
    }
}
